//地址：https://www.lanqiao.cn/problems/20133/learning/
#include<iostream>
#include<utility>
#include<map>
using namespace std;

int gcd(int a, int b)
{
    return (b == 0) ? a : gcd(b, a % b);
}


int main()
{
    // 请在此输入您的代码
    int n;

    int ans = 0;

    map<pair<int, int>, int> cnt;


    cin >> n;

    map<pair<int, int>, int> m;   //用map就可以实现计数效果了，没必要用unordered_map，必须要自定义一个排序函数

    for (int i = 0;i < n;i++)
    {
        int x1, y1, x2, y2;

        cin >> x1 >> y1 >> x2 >> y2;

        int c_x = x2 - x1;

        int c_y = y2 - y1;

        int g = abs(gcd(c_x, c_y));    //这里的绝对值很关键，因为g表示可以分为多少段


        for (int j = 0;j <= g;j++)
        {
            int x = x1 + j * c_x / g;

            int y = y1 + j * c_y / g;

            cnt[{x, y}]++;
        }

    }

    for (const auto& ele : cnt)
    {
        if (ele.second >= 2) ans++;
    }

    cout << ans << endl;

    return 0;
}